; ModuleID = 'hello.c'
target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64"
target triple = "x86_64-unknown-linux-gnu"

@.str = private constant [4 x i8] c"%d\0A\00", align 1
@.str1 = private constant [3 x i8] c"%d\00", align 1
@.str2 = private constant [4 x i8] c"%d \00", align 1

define i32 @fib(i32 %n) nounwind {
entry:
  %n_addr = alloca i32, align 4
  %retval = alloca i32
  %0 = alloca i32
  %"alloca point" = bitcast i32 0 to i32
  store i32 %n, i32* %n_addr
  %1 = load i32* %n_addr, align 4
  %2 = icmp sgt i32 %1, 1
  br i1 %2, label %bb, label %bb1

bb:                                               ; preds = %entry
  %3 = load i32* %n_addr, align 4
  %4 = sub nsw i32 %3, 1
  %5 = call i32 @fib(i32 %4) nounwind
  %6 = load i32* %n_addr, align 4
  %7 = sub nsw i32 %6, 2
  %8 = call i32 @fib(i32 %7) nounwind
  %9 = add nsw i32 %5, %8
  store i32 %9, i32* %0, align 4
  br label %bb4

bb1:                                              ; preds = %entry
  %10 = load i32* %n_addr, align 4
  %11 = icmp eq i32 %10, 1
  br i1 %11, label %bb2, label %bb3

bb2:                                              ; preds = %bb1
  store i32 1, i32* %0, align 4
  br label %bb4

bb3:                                              ; preds = %bb1
  store i32 0, i32* %0, align 4
  br label %bb4

bb4:                                              ; preds = %bb3, %bb2, %bb
  %12 = load i32* %0, align 4
  store i32 %12, i32* %retval, align 4
  br label %return

return:                                           ; preds = %bb4
  %retval5 = load i32* %retval
  ret i32 %retval5
}

define i32 @print(i32* %a) nounwind {
entry:
  %a_addr = alloca i32*, align 8
  %retval = alloca i32
  %i = alloca i32
  %"alloca point" = bitcast i32 0 to i32
  store i32* %a, i32** %a_addr
  %0 = load i32** %a_addr, align 8
  %1 = getelementptr inbounds i32* %0, i64 0
  %2 = load i32* %1, align 1
  %3 = call i32 (i8*, ...)* @printf(i8* noalias getelementptr inbounds ([4 x i8]* @.str, i64 0, i64 0), i32 %2) nounwind
  %4 = load i32** %a_addr, align 8
  %5 = getelementptr inbounds i32* %4, i64 1
  %6 = load i32* %5, align 1
  %7 = call i32 (i8*, ...)* @printf(i8* noalias getelementptr inbounds ([4 x i8]* @.str, i64 0, i64 0), i32 %6) nounwind
  br label %return

return:                                           ; preds = %entry
  %retval1 = load i32* %retval
  ret i32 %retval1
}

declare i32 @printf(i8* noalias, ...) nounwind

define i32 @main() nounwind {
entry:
  %retval = alloca i32
  %a = alloca [40 x i32]
  %n = alloca i32
  %i = alloca i32
  %"alloca point" = bitcast i32 0 to i32
  %0 = call i32 (i8*, ...)* @"\01__isoc99_scanf"(i8* noalias getelementptr inbounds ([3 x i8]* @.str1, i64 0, i64 0), i32* %n) nounwind
  store i32 1, i32* %i, align 4
  br label %bb1

bb:                                               ; preds = %bb1
  %1 = load i32* %i, align 4
  %2 = call i32 @fib(i32 %1) nounwind
  %3 = call i32 (i8*, ...)* @printf(i8* noalias getelementptr inbounds ([4 x i8]* @.str2, i64 0, i64 0), i32 %2) nounwind
  %4 = load i32* %i, align 4
  %5 = add nsw i32 %4, 1
  store i32 %5, i32* %i, align 4
  br label %bb1

bb1:                                              ; preds = %bb, %entry
  %6 = load i32* %n, align 4
  %7 = load i32* %i, align 4
  %8 = icmp sle i32 %7, %6
  br i1 %8, label %bb, label %bb2

bb2:                                              ; preds = %bb1
  br label %return

return:                                           ; preds = %bb2
  %retval3 = load i32* %retval
  ret i32 %retval3
}

declare i32 @"\01__isoc99_scanf"(i8* noalias, ...) nounwind
